package net.mcreator.toolsasfood.procedures;

import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.eventbus.api.Event;
import net.minecraftforge.event.world.BlockEvent;

import net.minecraft.world.level.LevelAccessor;
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.entity.Entity;

import net.mcreator.toolsasfood.init.ToolsAsFoodModMobEffects;

import javax.annotation.Nullable;

@Mod.EventBusSubscriber
public class NetheritePickaxeBrokeProcedure {
	@SubscribeEvent
	public static void onBlockBreak(BlockEvent.BreakEvent event) {
		execute(event, event.getWorld(), event.getPos().getX(), event.getPos().getY(), event.getPos().getZ(), event.getPlayer());
	}

	public static void execute(LevelAccessor world, double x, double y, double z, Entity entity) {
		execute(null, world, x, y, z, entity);
	}

	private static void execute(@Nullable Event event, LevelAccessor world, double x, double y, double z, Entity entity) {
		if (entity == null)
			return;
		double fx = 0;
		double fy = 0;
		double fz = 0;
		double nx = 0;
		double nz = 0;
		if (entity instanceof LivingEntity _livEnt ? _livEnt.hasEffect(ToolsAsFoodModMobEffects.NETHERITE_PICKAXE_INGOT) : false) {
			NetheritePickaxeProcedure.execute(world, x, y, z, entity);
		}
	}
}
